package com.example.review.Fragment;


import android.app.AlertDialog;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;

import androidx.fragment.app.Fragment;

import com.example.review.R;

/**
 * A simple {@link Fragment} subclass.
 */
public class AlertDialogFragment extends Fragment {
    private View view;

    public AlertDialogFragment() {
        // Required empty public constructor
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        view = inflater.inflate(R.layout.fragment_alert_dialog, container, false);
        AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
        View alert = LayoutInflater.from(getContext()).inflate(R.layout.layout_alert, null);
        ViewHolder holder = new ViewHolder(alert);
        builder.setView(alert);
        builder.setCancelable(true);
        AlertDialog dialog = builder.create();
        dialog.setCancelable(true);
        dialog.show();
        return view;
    }

    public class ViewHolder {
        public View rootView;
        public ProgressBar progress;

        public ViewHolder(View rootView) {
            this.rootView = rootView;
            this.progress = (ProgressBar) rootView.findViewById(R.id.progress);
        }

    }
}
